import axios from 'axios'
import * as actionTypes from './actionTypes'

const initDetailContent = (data) => ({
  type: actionTypes.INIT_DETAILS_CONTENT,
  data
})

export const getInitDetailContent = () => {
  return async (dispatch) => {
    const { data: res } = await axios.get('/api/details.json')
    if (res.status !== 200) return
    dispatch(initDetailContent(res.data))
  }
}